package com.atosworldline.tfm.service;

import javax.inject.Named;
import javax.inject.Inject;
import javax.persistence.PersistenceException;
import org.resthub.core.service.GenericServiceImpl;
import com.atosworldline.tfm.dao.DocumentDao;
import com.atosworldline.tfm.model.Document;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.ArrayList;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
@Named("documentService")
public class DocumentServiceImpl extends GenericServiceImpl<Document, Long, DocumentDao> implements DocumentService {

static DocumentService REFERENCE;
	@Inject
		@Named("documentDao")
		@Override
		public void setDao(DocumentDao dao) {
			this.dao = dao;
			REFERENCE = this;
		}


	@Override
		public Document update(Document document){
			document = dao.saveAndFlush(document);
			return document;
		}

	public static DocumentService getDocumentService(){
		return REFERENCE;
	}
}
